import Vue from 'vue';
import VueActionSheet from './actionSheet.vue';

const ActionSheet = Vue.extend(VueActionSheet);
/**
 * actionSheet - options
 * 
 * @param title 标题
 * @param itemList 按钮的文字数组
 * @param itemFunction 用户点击的按钮回调
 * @param cancelFunction 取消回调
 */
const actionSheet = (options) => {
    // 实例
    const instance = new ActionSheet();
    instance.vm = instance.$mount();
    document.body.appendChild(instance.vm.$el);
    // 赋值
    instance.title = options.title;
    instance.itemList = options.itemList;
    instance.itemFunction = options.itemFunction;
    instance.cancelFunction = options.cancelFunction;
}

export default actionSheet